home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
- Subject: Re: Undefined behavior? on type conversion, was: Re: Hungarian notation
- Date: Fri, 02 Feb 1996 03:53:33 GMT
- Organization: Netcom
- Message-ID: <31118641.6802368@nntp.ix.netcom.com>
- References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4er2qo$h2s@galaxy.ucr.edu>
- NNTP-Posting-Host: ix-dc11-10.ix.netcom.com
- X-NETCOM-Date: Thu Feb 01 7:54:13 PM PST 1996
- X-Newsreader: Forte Agent .99c/16.141
-
- thp@cs.ucr.edu (Tom Payne) wrote:
-
- > James Kanze US/ESC 60/3/141 #40763 (kanze@lts.sel.alcatel.de) wrote:
- > : miker3@ix.netcom.com (Mike Rubenstein) writes:
- > : [...]
- > : |> Is it really necessary to post this kind of nonsense. No, the
- > : |> documentation may not say the result is to delete your system disk.
- > : |> Repeating the quote from ISO 6.2.1.2
- > :
- > : |> When a value with integral type is demoted to a signed integer
- > : |> with smaller size or an unsigned integer is converted to its
- > : |> corresponding signed integer, if the value cannot be
- > : |> represented the result is implementation defined.
- > :
- > : |> This requires an implementation to convert the integral type. It does
- > : |> not give it license to take actions not specified by the standard.
- > :
- > : Does it? I believe that it was the intent of the authors that the
- > : `result' of the conversion could be a signal (for example) or a core
- > : dump. (This is, of course, the only reasonable thing for an
- > : implementation to do.)
- >
- > In 6.2.1.2, quoted above, it is not clear whether "result" refers to
- > the "resulting value" or to the "resulting behavior". IMHO, it should
- > unambiguously refer to the former --- I see no need to open the door
- > to the various shenanigans that standard euphemistically calls,
- > "undefined behavior."
-
- I certainly wouldn't argue against the claim that it should be made
- clearer -- obviously there is some difference of opinion.
-
- But, I don't see how one can claim the conversion may not be done.
- 6.3.4 says
-
- Preceding an expression by a parenthesized type name converts
- the value to the named type.
-
- Consider a machine with 8 bit char and the expression
-
- (char) 256
-
- Here we have correct syntax and correct data. The standard says that
- this converts the number 256 to a char. I believe I have a right to
- assume that this will be done.
-
-
- Michael M Rubenstein
-